package com.yn.club.auth.application.controller;



import com.yn.club.auth.domain.entity.AuthRolePermissionDO;
import com.yn.club.auth.domain.service.AuthRolePermissionDomainService;
import org.springframework.web.bind.annotation.*;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import javax.validation.constraints.NotEmpty;
import java.io.Serializable;
import java.util.List;
import com.yn.club.common.util.R;
import com.yn.club.common.util.PageReq;
import com.yn.club.common.util.PageResp;
import com.yn.club.auth.application.convert.AuthRolePermissionApplicationConverter;
import com.yn.club.auth.application.request.AuthRolePermissionQueryRequest;
import com.yn.club.auth.application.request.AuthRolePermissionSaveRequest;

/**
 * 角色权限关联表(AuthRolePermission)表控制层
 *
 * @author YN
 * @since 2025-01-22 17:11:12
 */
@Slf4j
@RequiredArgsConstructor
@Validated
@RestController
@RequestMapping("authRolePermission")
public class AuthRolePermissionController {
    /**
     * 服务对象
     */
    private final AuthRolePermissionDomainService authRolePermissionDomainService;
    private final AuthRolePermissionApplicationConverter authRolePermissionApplicationConverter;


    /**
     * 新增数据
     *
     * @param authRolePermission 实体对象
     * @return 受影响条数
     */
    @PostMapping("/insert")
    public R<Boolean> insert(@RequestBody @Validated AuthRolePermissionSaveRequest authRolePermission) {
       AuthRolePermissionDO authRolePermissionDO = authRolePermissionApplicationConverter.convertSaveRequestToDo(authRolePermission);
        return R.ok(this.authRolePermissionDomainService.insert(authRolePermissionDO));
    }

}

